<template>
  <div>
     <NavHead>
      <template v-slot:iconfont-left>
        <i class="iconfont icon-arrowLeft arrow" @click="$router.back()"></i>
      </template>
      <template v-slot:title>
        <SearchInput />
      </template>
      <template v-slot:iconfont-right>
        <i class="iconfont icon-gouwuche point" @click="jumpCar"></i>
      </template>
    </NavHead>
    <ShopSwiper />
    <div>
      <p class="title">所有分类</p>
      <div class="list">
        <div class="pic" v-for="(item,index) in list" :key="index" @click="jumpBedroom(item.id)">
          <img :src="item.img" alt="" />
          <p>{{item.title}}</p>
        </div>
      </div>
    </div>
    <div class="pic-list"> 
        <div class="life" v-for="(items,index) in arr" :key="index">
            <div class="desc"   >
            <p>{{items.title}}</p>
        </div>  
            <img :src="items.img" alt="">
        </div>
    </div>
  </div>
</template>

<script>
import api from "../../api"
import Head from "../../components/head/Head";
import ShopSwiper from "./shopSwiper/ShopSwiper1";
import NavHead from "../../components/NavHead";
import SearchInput from "../../components/searchInput/SearchInput"

export default {
  name: "NewProduct",
  data(){
      return{
          list:[],
          arr:[]
      }
  },
  components: {
    NavHead,
    ShopSwiper,
    SearchInput
  },
  mounted(){
      api.getAllClassify({
          id:this.list.id
      }).then(res => {
        //   console.log(res.data);
          this.list=res.data.list
      })
      api.getQualityLife().then(res => {
          // console.log(res.data);
          this.arr=res.data.list
      })

  },
  methods:{
    jumpBedroom(id){
        // console.log(id);
        this.$router.push({name:"Bedroom",params:{id}})
    },
    jumpCar(){
      this.$router.push({name:'ShopCar'})
    }
  }
};
</script>

<style scoped>
.arrow {
  color: #fff;
  margin-top: 0.3rem;
}
.point {
  color: #fff;
  font-size: 0.5rem;
}
.title {
  font-size: 0.3rem;
  margin-top: 0.2rem;
  margin-bottom: 0.2rem;
  color: rgb(71, 67, 67);
}
.list {
  height:4rem;
  width: 95%;
  margin-left: 2.5%;
  border-radius: 1px solid #d3d3d3;
  display: flex;
  flex-wrap: wrap;
  padding-top: 0.2rem;
  padding-bottom: 0.2rem;
  box-sizing: border-box;
  -webkit-box-shadow: #ccc 0px 0px 10px;
  -moz-box-shadow: #ccc 0px 0px 10px;
  box-shadow: #ccc 0px 0px 10px;
}
.list .pic{
  width: 33.3%;

}
.list .pic img {
  height: 1.2rem;
  width: 1.2rem;
  margin-top: 0.1rem;
  border-radius: 50%;
}
.list .pic p {
  font-size: 0.24rem;
}
.life .desc{
    width: 2rem;
    margin-top: 0.1rem;
    font-size: 0.24rem;
    float:right;
}
.pic-list .life  img{
  height:3rem;
  width: 95%;
  border-radius: 1px solid #d3d3d3;
  margin-top: 0.1rem;
}
</style>